package com.lemt.common.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lemt.common.pojo.Address;
import com.lemt.common.result.Res;
import com.lemt.common.service.IAddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.UUID;

@Api(tags = "图片操作")
@RestController
@RequestMapping("/common/address")
public class AddressController {


    @Resource(name = "AddressService")
    private IAddressService addressService;


    @PostMapping("/addAddress")
    public Res<Boolean> addAddress(@RequestBody Address address){
        return Res.ok(addressService.save(address));

    }
    @PostMapping("/removeById")
    public Res<Boolean> removeAddress(@RequestBody Address address){
        return Res.ok(addressService.removeById(address));
    }
    @PostMapping("/updateById")
    public Res<Boolean> update(@RequestBody Address address){
        return Res.ok(addressService.updateById(address));
    }
    @GetMapping("/getAll/{userId}")
    public Res<List<Address>> getAll(@PathVariable Integer userId){
        return Res.ok(addressService.getAll(userId));
    }


}
